package com.nl.util;

import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public final class ConfigUtils {

	private static final Logger log = LoggerFactory.getLogger(ConfigUtils.class);

	private ConfigUtils() {
		log.info("Initialize ConfigUtils.......");
	}

	private static class SingletonHolder {
		private static final ConfigUtils instance = new ConfigUtils();
	}

	public static ConfigUtils getInstance() {
		return SingletonHolder.instance;
	}

	private String loadProperties(String filePath, String key) {
		String result = null;
		try {
			Properties prop = new Properties();
			prop.load(new FileInputStream(new File(filePath)));
			result = prop.getProperty(key);
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}
		return result;
	}

	public String getValue(String key) {
		return loadProperties("D:\\workspace\\sms\\smscard\\EmergencyFilterProcess\\cfg\\njsms.properties", key);
	}



}
